package com.jdrx.sw.sewage.service;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.jdrx.sw.sewage.beans.dto.SludgeAnalysisAddDTO;
import com.jdrx.sw.sewage.beans.dto.SludgeAnalysisQueryDTO;
import com.jdrx.sw.sewage.beans.dto.SludgeAnalysisUpdateDTO;
import com.jdrx.sw.sewage.beans.entity.SludgeAnalysisPO;
import com.jdrx.sw.sewage.beans.vo.base.PageVO;
import com.jdrx.sw.sewage.dao.SludgeAnalysisDAO;

@Service
public class SludgeAnalysisService {
	@Autowired
	private SludgeAnalysisDAO sludgeAnalysisDAO;
	
	public void add(SludgeAnalysisAddDTO dto) {
		SludgeAnalysisPO po = new SludgeAnalysisPO();
		BeanUtils.copyProperties(dto, po);
		sludgeAnalysisDAO.insert(po);
	}
	
	public void update(SludgeAnalysisUpdateDTO dto) {
		SludgeAnalysisPO po = new SludgeAnalysisPO();
		BeanUtils.copyProperties(dto, po);
		sludgeAnalysisDAO.update(po);
	}
	
	public PageVO<SludgeAnalysisPO> pageList(SludgeAnalysisQueryDTO dto) {
		PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
		return PageVO.toPageVO(sludgeAnalysisDAO.listAll());
	}
}